Marks MutTxId as !Send#3972
Merged
Shubham8287 merged 3 commits intoshub/fix-procedures-deadlockfrom Jan 14, 2026
Merged
Conversation
Shubham8287
commented
Jan 8, 2026
gefjon
approved these changes
Jan 14, 2026
|
|
||
| #[derive(Clone, Default)] | ||
| pub struct TxSlot { | ||
| // Wrapped in Mutex for interior mutability. |
Contributor
There was a problem hiding this comment.
I don't see this comment as particularly helpful. Obviously the mutex is for interior mutability, that's what mutexes do. A more useful comment would describe why interior mutability is necessary: do we hold multiple & shared references to a single TxSlot, or do we clone the inner Arc? Who holds these pointers, and when do they access them?
| pub timer: Instant, | ||
| pub ctx: ExecutionContext, | ||
| pub metrics: ExecutionMetrics, | ||
| // Marks `MutTxId` as `!Send` by embedding a non-`Send` type. |
Contributor
There was a problem hiding this comment.
Suggested change
| // Marks `MutTxId` as `!Send` by embedding a non-`Send` type. | |
| /// Marks `MutTxId` as `!Send` by embedding a non-`Send` type. | |
| /// | |
| /// We want `MutTxId` to be `!Send` to prevent holding it across `await` points, | |
| /// which would lead to deadlocks. | |
| /// It is not possible to invoke Undefined Behavior by improperly sending a `MutTxId`, | |
| /// but it will likely deadlock and cause SpacetimeDB to become unresponsive. |
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io> Signed-off-by: Shubham Mishra <shivam828787@gmail.com>
Shubham8287
added a commit
that referenced
this pull request
Jan 14, 2026
Merged
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jan 16, 2026
# Description of Changes Same as #3972. Merged the original PR into wrong branch instead of mater :) --------- Signed-off-by: Shubham Mishra <shivam828787@gmail.com> Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Depends on #3968.
Makes
MutTxId,!Sendto avoid being deadlocked by holding it acrossawaitpointsafter taking learnings from #3938 and #3968.
API and ABI breaking changes
NA
Expected complexity level and risk
1, It only increases the compile time safety.
Testing
Existing should be enough.